
<?php	
	
	class attribute extends database
	{
		var $connection = '';	

		function attribute()
		{
			parent::database();
		}
	
		function GetListPaging()
		{						
			$this->setQuery("set names utf8");
			$this->query();
			return $sql = "Select * from vnf_attribute";			
			//return $pager;
			//$rs = $pager->paginate();
	//Loop through the result set
				
			/*$this->setQuery($sql);
			$value = $this->loadAllRow();
			return $value;*/
		}
		
		function GetList()
		{						
			$this->setQuery("set names utf8");
			$this->query();			
			$sql = "SELECT a.*, p.* from vnf_attribute a
            INNER JOIN vnf_product p ON a.ProductNo = p.ProductNo 
             ";			
			$this->setQuery($sql);
			$value = $this->loadAllRow();
			return $value;
		}
        
        function AddAttribute($ProductNo, $SKU, 
            $Attribute1, $Attribute2, $Attribute3, $Attribute4, $Attribute5, 
            $Attribute6, $Attribute7, $Attribute8, $Attribute9, $Attribute10, 
            $Price, $Cost, $Quantity, $Unit, $Weight, $Length, $Height, 
            $Width, $ContainerCode, $BillingInterval, $SubscriptionPeriod, 
            $IntervalBegin, $NewBillType, $StartupFee, $RenewUpdateInd, $Isbn, 
            $Mpn, $Upc, $Condition, $StoreQTY) 
		{
           
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "Insert into vnf_attribute(`ProductNo`, `SKU`, 
            `Attribute1`, `Attribute2`, `Attribute3`, `Attribute4`, `Attribute5`, 
            `Attribute6`, `Attribute7`, `Attribute8`, `Attribute9`, `Attribute10`, 
            `Price`, `Cost`, `Quantity`, `Unit`, `Weight`, `Length`, `Height`, 
            `Width`, `ContainerCode`, `BillingInterval`, `SubscriptionPeriod`, 
            `IntervalBegin`, `NewBillType`, `StartupFee`, `RenewUpdateInd`, `Isbn`, 
            `Mpn`, `Upc`, `Condition`, `StoreQTY`) 
            values('".$ProductNo."', '".$SKU."', '".$Attribute1."', '".$Attribute2."', '".$Attribute3."'
            , '".$Attribute4."', '".$Attribute5."', '".$Attribute6."', '".$Attribute7."', '".$Attribute8."', '".$Attribute9."'
            , '".$Attribute10."', '".$Price."', '".$Cost."', '".$Quantity."', '".$Unit."', '".$Weight."'
            , '".$Length."', '".$Height."', '".$Width."', '".$ContainerCode."', '".$BillingInterval."', 
            '".$SubscriptionPeriod."', '".$IntervalBegin."', '".$NewBillType."', '".$StartupFee."', 
            '".$RenewUpdateInd."', '".$Isbn."', '".$Mpn."', '".$Upc."', '".$Condition."', '".$StoreQTY."')";
            echo $sql;
			$this->setQuery($sql);
			$this->query();
		}
		
		function UpdateAttribute($ProductNo, $SKU, 
            $Attribute1, $Attribute2, $Attribute3, $Attribute4, $Attribute5, 
            $Attribute6, $Attribute7, $Attribute8, $Attribute9, $Attribute10, 
            $Price, $Cost, $Quantity, $Unit, $Weight, $Length, $Height, 
            $Width, $ContainerCode, $BillingInterval, $SubscriptionPeriod, 
            $IntervalBegin, $NewBillType, $StartupFee, $RenewUpdateInd, $Isbn, 
            $Mpn, $Upc, $Condition, $StoreQTY, $id)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "";
			$sql = "Update vnf_attribute set `ProductNo` =  '".$ProductNo."',
            `SKU` =  '".$SKU."', `Attribute1` =  '".$Attribute1."', 
            `Attribute2` =  '".$Attribute2."', `Attribute3` =  '".$Attribute3."'
            , `Attribute4` =  '".$Attribute4."', `Attribute5` =  '".$Attribute5."'
            , `Attribute6` =  '".$Attribute6."', `Attribute7` =  '".$Attribute7."'
            , `Attribute8` =  '".$Attribute8."', `Attribute9` =  '".$Attribute9."'
            , `Attribute10` =  '".$Attribute10."', `Price` =  '".$Price."'
            , `Cost` =  '".$Cost."', `Quantity` =  '".$Quantity."', `Unit` =  '".$Unit."', `Weight` =  '".$Weight."'
            , `Length` =  '".$Length."', `Height` =  '".$Height."'
            , `Width` =  '".$Width."', `ContainerCode` =  '".$ContainerCode."', `BillingInterval` =  '".$BillingInterval."'
            , `SubscriptionPeriod` =  '".$SubscriptionPeriod."', `IntervalBegin` =  '".$IntervalBegin."'
            , `NewBillType` =  '".$NewBillType."', `StartupFee` =  '".$StartupFee."'
            , `RenewUpdateInd` =  '".$RenewUpdateInd."', `Isbn` =  '".$Isbn."'
            , `Mpn` =  '".$Mpn."', `Upc` =  '".$Upc."'
            , `Condition` =  '".$Condition."', `StoreQTY` =  '".$StoreQTY."'";
			$sql .= " where AttributeID=".$id;	
            //echo $sql;		
			$this->setQuery($sql);
			$this->query();
		}
		
		function GetOneAttribute($id)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "Select * from vnf_attribute where AttributeID=".$id."";
			$this->setQuery($sql);
			$row = $this->loadOneRow();
			return $row;
		}
		
		function DeleteAttribute($id)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "";
			$sql = "Delete from vnf_attribute ";
			$sql .= " where AttributeID=".$id;			
			
			$this->setQuery($sql);
			$this->query();
		}
	
		
	}
?>